1 CLS : DEBUG = 0: IF DEBUG = 1 THEN PRINT "Debug Mode: Enter CONT": STOP: REM >>> RUN
2 DIM Q$(6), D$(7), MSG$(25), MA$(11): GOSUB 670: REM Initialize Constants
3 DIM D(7), G%(8, 8), G(8, 8), C(4, 2), Q(8, 8), K(10, 3), MA(11), R02(24), K$(10), N$(3)
4 DEF FNO (F) = SQR((K(F, 1) - S1) ^ 2 + (K(F, 2) - S2) ^ 2)
5 GOTO 555: REM Goto Main Control
6 REM >>> Process Captain's Command
7 IF V0 = 3 THEN GOSUB 722: GOSUB 513: GOSUB 288
8 CMD$ = "": WHILE CMD$ = "": PRINT : INPUT "COMMAND: ", CMD$: WEND
9 IF LEFT$(CMD$ + "x", 1) = "C" THEN CLS : IF LEFT$(CMD$ + "xx", 2) = "C " THEN CMD$ = RIGHT$(CMD$, LEN(CMD$) - 2) ELSE CMD$ = RIGHT$(CMD$, LEN(CMD$) - 1)
10 IF LEN(CMD$) = 2 THEN Y = INSTR("0L0R0U0D", CMD$): IF Y > 0 THEN C1$ = MID$("5x1x3x7x", Y, 1): CMD$ = "^r": CMD = 0: W1$ = ".125"
11 IF CMD$ = "^r" THEN 20
12 IF CMD$ = "0" THEN CMD = 0: GOTO 26
13 CMD = VAL(CMD$): Z$ = STR$(INT(ABS(CMD))): IF CMD$ = RIGHT$(Z$, LEN(Z$) - 1) THEN 20
14 IF CMD$ = "BOSS" THEN CLS : GOSUB 699: GOSUB 521: GOTO 748
15 IF CMD$ = "SAVE" THEN GOSUB 699: GOTO 8
16 IF CMD$ = "RESTORE" THEN V0 = 3: GOTO 7
17 IF CMD$ = "STOP" THEN GOSUB 521: KEY 9, "locate 23,1" + CHR$(13): STOP: GOSUB 519: GOTO 8
18 IF CMD$ = "UFK" THEN PRINT "Undefined Function Key": GOTO 8
19 GOSUB 501: GOTO 8
20 IF CMD < 5 THEN ON CMD + 1 GOTO 26, 41, 43, 44, 45
21 IF CMD < 10 THEN ON CMD - 4 GOTO 47, 48, 49, 50, 51
22 IF CMD < 16 THEN ON CMD - 9 GOTO 52, 53, 54, 55, 57, 56
23 IF CMD = 55 THEN GOSUB 58: RETURN
24 IF CMD = 99 THEN LD = 1: GOSUB 513: LD = 0: RETURN
25 GOSUB 501: GOTO 8
26 GOSUB 129
27 REM --- entry for random events and movement
28 IF C1 = 0 THEN RETURN
29 IF RND(1) > .9 THEN IF C(1, 2) <> 9 THEN C1 = 0: PRINT "COMMAND ABORTED DUE TO TRACTOR BEAM": GOSUB 339: RETURN
30 IF S% = 1 THEN E3 = E3 - (150 * W1): IF E3 <= 0 THEN RETURN
31 IF K3 > 0 THEN M1 = 6: GOSUB 408
32 IF E3 <= 100! THEN M1 = 11: GOSUB 408
33 M1 = T3 - T0: IF M1 < 5 THEN M1 = 0 ELSE IF M1 < 10 THEN M1 = 4 ELSE IF M1 < 18 THEN M1 = 3 ELSE IF M1 < 30 THEN M1 = 2 ELSE M1 = 1
34 IF M1 > 0 THEN GOSUB 408
35 GOSUB 273
36 IF CMD$ = "^r" AND CMD = 13 AND YNA$ = "n" THEN Q% = 1: WHILE Q% = 1: GOSUB 37: WEND: UU$ = "x": WHILE UU$ <> "": UU$ = INKEY$: WEND: RETURN
37 IF RND(1) < .2 THEN Q% = 0: GOSUB 356: REM Space Storm and Truce
38 GOSUB 142
39 IF RND(1) > .95 THEN Q% = 0: GOSUB 320: REM Supernova
40 RETURN
41 IF D(2) < 0 THEN C1 = 0 ELSE C1 = 9
42 GOSUB 113: RETURN
43 IF D(3) < 0 THEN PRINT "LONG RANGE SENSORS ARE DAMAGED": RETURN ELSE GOSUB 167: RETURN
44 IF D(4) < 0 THEN PRINT "PHASER CONTROL IS DISABLED": RETURN ELSE IF S% > 0 THEN 46 ELSE C1 = 9: GOSUB 178: RETURN
45 IF D(5) < 0 THEN PRINT "PHOTON TUBES ARE NOT OPERATIONAL": RETURN ELSE IF S% = 0 THEN C1 = 9: GOSUB 195: RETURN
46 PRINT "YOU MUST LOWER YOUR ENERGY SHIELDS TO FIRE.": RETURN
47 IF D(6) < 0 THEN PRINT "DAMAGE CONTROL REPORT IS NOT AVAILABLE.": RETURN ELSE GOSUB 228: RETURN
48 GOSUB 392: RETURN
49 GOSUB 311: RETURN
50 IF D(7) < 0 THEN PRINT "ENERGY SHIELDS DISABLED.": RETURN ELSE C1 = 9: GOSUB 363: RETURN
51 C1 = 9: GOSUB 368: RETURN
52 GOSUB 290: RETURN
53 GOSUB 427: RETURN
54 GOSUB 412: GOTO 27
55 GOSUB 268: C1 = 9: W1 = 0: GOTO 27
56 GOSUB 513
57 GOSUB 288: RETURN
58 REM >>> #55 Debug Area
59 PRINT "debug"
60 FOR MC = 1 TO 7: D(MC) = 0: NEXT: E3 = 20000: A3 = 10000: P3 = 100
61 RETURN
62 REM >>> Get Answer
63 IF CMD$ = "^r" THEN RETURN
64 PRINT YNQ$; : INPUT ""; YNA$: YNA$ = LEFT$(YNA$ + " ", 1)
65 IF YNA$ = "Y" OR YNA$ = "y" OR YNA$ = "1" THEN YNA$ = "y": RETURN
66 IF YNA$ = "N" OR YNA$ = "n" OR YNA$ = "0" THEN YNA$ = "n": RETURN
67 PRINT CHR$(10); "Please answer Y or N": GOTO 64
68 REM >>> Get Course
69 IF CMD$ <> "^r" THEN INPUT "COURSE (1-9)"; C1$
70 C1 = VAL(C1$): IF C1 = 0 THEN RETURN
71 IF C1 < 1 OR C1 > 9 THEN 69 ELSE IF C1 = 9 THEN C1 = 1
72 RETURN
73 REM >>> Compute Tracking Constants
74 VT = .7854 * (C1 + 1): VS = SIN(VT): IF ABS(VS) < .001 THEN VS = 0
75 VC = COS(VT): IF ABS(VC) < .001 THEN VC = 0
76 IF ABS(VS) > ABS(VC) THEN VD = ABS(1 / VS) ELSE VD = ABS(1 / VC)
77 VX = VD * VC: VY = VD * VS: RETURN
78 REM >>> Entering a new Quadrant
79 IF Z2 = 1 THEN Z2 = 0: GOSUB 441
80 PRINT : PRINT "* * * * *": PRINT "CURRENT POSITION OF "; N$: PRINT "QUADRANT"; Q1; "-"; Q2; "       ";
81 IF G(Q1, Q2) > 999 THEN PRINT "ZAP! SIZZLE! CRACKLE! POP!": PRINT "NO!!  A SUPERNOVA HAS OCCURRED IN THIS QUADRANT!": KIRK = 0: GOSUB 471: LD = 1: GOSUB 513: LD = 0: RETURN
82 IF KX > 8 THEN KX = 8 ELSE IF KX < 1 THEN KX = 1
83 IF KY > 8 THEN KY = 8 ELSE IF KY < 1 THEN KY = 1
84 S1 = INT(KX): S2 = INT(KY): GOSUB 87
85 PRINT "SECTOR"; S1; "-"; S2
86 QQ1 = Q1: QQ2 = Q2: KX = S1 + .5: KY = S2 + .5: M2 = 0: RETURN
87 REM >>> Set up Quadrant
88 FOR i = 1 TO 8: FOR J = 1 TO 8: Q(i, J) = 0: NEXT: NEXT: Q(S1, S2) = N1
89 FOR i = 1 TO 9: K(i, 1) = 0: K(i, 2) = 0: NEXT
90 KK$ = STR$(1000 + G(Q1, Q2)): K3 = VAL(MID$(KK$, 3, 1)): B3 = VAL(MID$(KK$, 4, 1)): S3 = VAL(MID$(KK$, 5, 1)): IF K3 > 6 THEN M1 = 5: GOSUB 408
91 IF S3 > 0 THEN FOR i = 1 TO S3: GOSUB 448: Q(R1, R2) = 4: NEXT
92 IF B3 > 0 THEN FOR i = 1 TO B3: GOSUB 448: Q(R1, R2) = 3: NEXT
93 IF K3 > 0 THEN  ELSE RETURN
94 FOR i = 1 TO K3: GOSUB 448: Q(R1, R2) = 2: K(i, 1) = R1: K(i, 2) = R2: NEXT: FOR i = 1 TO 4: IF Q1 = C(i, 1) THEN IF Q2 = C(i, 2) THEN Q(R1, R2) = 6
95 NEXT: IF Z6 = 1 THEN Z6 = 0: GOTO 98: REM Local tractor beam
96 FOR i = 1 TO K3: K(i, 3) = 200: NEXT: IF Q(R1, R2) = 6 THEN K(K3, 3) = 600
97 FOR i = K3 + 1 TO 9: K(i, 3) = 0: NEXT: RETURN
98 i1 = 0: FOR i = 1 TO 9: IF K(i, 3) > 0 THEN i1 = i1 + 1: K(i1, 3) = K(i, 3)
99 NEXT: FOR i = K3 + 1 TO 9: K(i, 3) = 0: NEXT: RETURN
100 REM >>> Determine if Starship is Docked
101 i1 = S1 - 1: I2 = S1 + 1: J1 = S2 - 1: J2 = S2 + 1
102 IF i1 < 1 THEN i1 = 1
103 IF I2 > 8 THEN I2 = 8
104 IF J1 < 1 THEN J1 = 1
105 IF J2 > 8 THEN J2 = 8
106 IF C$ = "DOCKED" THEN C$ = ""
107 FOR i = i1 TO I2: FOR J = J1 TO J2
108 IF Q(i, J) = 3 THEN i = I2: J = J2: IF C$ = "" THEN C$ = "DOCKED" ELSE C$ = "DOCKED": PRINT C$
109 NEXT: NEXT: IF C$ = "DOCKED" THEN GOSUB 112: RETURN
110 IF K3 > 0 THEN C$ = "RED" ELSE IF E3 < E0 * .1 THEN C$ = "YELLOW" ELSE C$ = "GREEN"
111 RETURN
112 E6 = E6 - E3 + E0: E3 = E0: P6 = P6 - P3 + P0: P3 = P0: A6 = A6 - A3 + A0: A3 = A0: RETURN: REM Supply Starship
113 REM >>> #01 Short Range Sensor Scan
114 IF D(2) = 0 THEN M2 = M2 + 1: IF M2 > 3 THEN M1 = 8: GOSUB 408
115 GOSUB 118: FOR i = 1 TO 8: FOR J = 1 TO 8
116 IF D(2) < 0 THEN PRINT CHR$(15); " ";  ELSE PRINT Q$(Q(i, J)); " ";
117 NEXT: GOSUB 119: NEXT
118 PRINT "--------------------------": RETURN
119 PRINT "    ";
120 IF i = 1 THEN PRINT "STARDATE      "; INT((10 * T3) + .5) / 10: RETURN
121 IF i = 2 THEN PRINT "CONDITION     "; C$: RETURN
122 IF i = 3 THEN PRINT "QUADRANT          "; Q1; "-"; Q2: G%(Q1, Q2) = 1: RETURN
123 IF i = 4 THEN PRINT "SECTOR            "; S1; "-"; S2: RETURN
124 IF i = 5 THEN PRINT "ENERGY            "; E3: RETURN
125 IF i = 6 THEN PRINT "PHOTON TORPEDOES "; P3: RETURN
126 IF i = 7 THEN PRINT "KLINGONS LEFT    "; K9: RETURN
127 PRINT "ENERGY SHEILDS   "; : IF S% = 1 THEN PRINT "UP";  ELSE PRINT "DOWN";
128 PRINT A3: RETURN
129 REM >>> #00 Warp Drive
130 GOSUB 68: IF C1 = 0 THEN RETURN: REM C1=Course
131 IF CMD$ <> "^r" THEN INPUT "WARP FACTOR (.1-12)"; W1$
132 W1 = VAL(W1$): IF W1 = 0 THEN C1 = 0: RETURN
133 IF W1 > .25 THEN IF D(1) < 0 THEN PRINT "WARP ENGINES ARE DAMAGED, MAXIMUM SPEED = WARP .25": CMD$ = "": GOTO 131
134 IF W1 < .1 THEN 131
135 IF W1 >= 12 THEN IF W1 > 12 THEN 131 ELSE IF T3 < T0 + 9 THEN PRINT "WARP 12 CANNOT BE USED UNTIL STARDATE"; T0 + 9: GOTO 131
136 IF W1 < 12 THEN RETURN
137 PRINT "SPEED APPROACHING WARP 12.": PRINT "ENGINES OPERATING ABOVE DANGER LEVEL.": PRINT "ALL SAFETY DEVICES DISFUNCTIONAL.": PRINT "CRITICAL OVERHEATING--SPONTANEOUS IMPLOSION IMMINENT."
138 FOR i = 1 TO 5: PRINT : T$ = TIME$: WHILE T$ = TIME$: WEND: NEXT: IF RND(1) < .3 THEN KIRK = 0: C1 = 0: RETURN
139 IF RND(1) < .6 THEN PRINT : PRINT "YOU WENT BACK IN TIME.": T3 = T3 - (14 * RND(1)): PRINT "*** STARDATE ="; INT((10 * T3) + 10.5) / 10: RETURN
140 IF RND(1) < .5 THEN PRINT : PRINT "YOU WENT FORWARD IN TIME.": T3 = T3 + 2 + RND(1): PRINT "*** STARDATE ="; INT((10 * T3) + .5) / 10: RETURN
141 PRINT : PRINT "NUCLEAR REACTOR CHAIN REACTION QUENCHED.": PRINT "*** TIME PORTAL MISSED ***": C1 = 1 + (RND(1) * 8): W1 = .1 + (RND(1) * 5): RETURN
142 REM >>> Move Starship Direction C1 Warp W1
143 N3 = W1 * 8: E3 = E3 - INT(2 * N3): IF E3 <= 0 THEN RETURN
144 Z7 = T3: Z8 = 4.166667E-02
145 Q(S1, S2) = 0
146 GOSUB 73: REM Compute Tracking Constants
147 IF N3 < VD THEN VD = N3: VX = VD * VC: VY = VD * VS
148 N3 = N3 - VD: T3 = T3 + (Z8 * VD): IF T3 > T9 THEN RETURN
149 KX = KX + VX: KY = KY + VY: S1 = INT(KX): S2 = INT(KY): IF S1 < 1 OR S1 > 8 OR S2 < 1 OR S2 > 8 THEN 153
150 Z5 = Q(S1, S2): IF Z5 > 0 THEN 163
151 IF N3 > 0 THEN 147
152 Q(S1, S2) = N1: RETURN
153 T3 = Z7 + (W1 / 3): IF T3 > T9 THEN RETURN
154 KX = KX + (N3 * VC): KY = KY + (N3 * VS)
155 WHILE KX < 1: KX = KX + 8: Q1 = Q1 - 1: WEND
156 WHILE KX >= 9: KX = KX - 8: Q1 = Q1 + 1: WEND
157 WHILE KY < 1: KY = KY + 8: Q2 = Q2 - 1: WEND
158 WHILE KY >= 9: KY = KY - 8: Q2 = Q2 + 1: WEND
159 IF Q1 <= 0 THEN Q1 = Q1 + 8: Z2 = 1: GOTO 159 ELSE IF Q1 >= 9 THEN Q1 = Q1 - 8: Z2 = 1: GOTO 159
160 IF Q2 <= 0 THEN Q2 = Q2 + 8: Z2 = 1: GOTO 160 ELSE IF Q2 >= 9 THEN Q2 = Q2 - 8: Z2 = 1: GOTO 160
161 IF Z2 = 1 THEN QQ1 = 0
162 RETURN
163 IF Z5 = 6 THEN Z3 = Q1: Z4 = Q2: GOSUB 424
164 IF (Z5 = 6) OR (Z5 = 2) THEN GOSUB 279: Q(S1, S2) = N1: RETURN
165 PRINT : PRINT N$; "BLOCKED BY OBJECT AT SECTOR"; S1; "-"; S2
166 KX = KX - VX: KY = KY - VY: S1 = INT(KX): S2 = INT(KY): Q(S1, S2) = N1: RETURN
167 REM >>> #02 Long Range Sensor Scan
168 PRINT "LONG RANGE SENSOR SCAN FOR QUADRANT"; Q1; "-"; Q2
169 PRINT "--------------------- #"
170 PRINT "    | Y"; Q2 - 1; "| Y"; Q2; " |Y"; Q2 + 1; "|"
171 PRINT "--------------------- #"
172 PRINT "    | KBS | KBS | KBS |"
173 PRINT "--------------------- #"
174 FOR i = Q1 - 1 TO Q1 + 1: FOR J = Q2 - 1 TO Q2 + 1
175 IF i < 1 OR i > 8 OR J < 1 OR J > 8 THEN N$(J - Q2 + 2) = "***" ELSE G%(i, J) = 1: IF G(i, J) < 1000 THEN N$(J - Q2 + 2) = RIGHT$("   " + STR$(G(i, J)), 3) ELSE N$(J - Q2 + 2) = "<*>"
176 NEXT: PRINT "X"; : PRINT i; : PRINT "| "; N$(1); " | "; N$(2); " | "; N$(3); " |"
177 PRINT "--------------------- #": NEXT: PRINT : RETURN
178 REM >>> #03 Phaser Control
179 PRINT "PHASERS LOCKED ON TARGET.  ENERGY AVAILABLE = "; E3
180 IF CMD$ <> "^r" THEN INPUT "NUMBER OF UNITS TO FIRE"; C1$
181 C1 = VAL(C1$): IF C1 = 0 THEN RETURN
182 IF C1 < 0 OR C1 > E3 THEN 179
183 E3 = E3 - C1
184 IF K3 = 0 THEN PRINT "PHASER ENERGY DISSIPATES IN SPACE.": RETURN
185 W2 = K3
186 FOR i = 1 TO 10
187 IF K(i, 3) <= 0 THEN 194
188 H3 = (C1) / (FNO(i)) * (3! + RND(1))
189 K(i, 3) = K(i, 3) - (H3 / W2)
190 PRINT H3 / W2; "UNIT HIT ON KLINGON AT SECTOR"; K(i, 1); "-"; K(i, 2)
191 PRINT "("; K(i, 3); "LEFT)"
192 IF K(i, 3) <= 0 THEN GOSUB 230
193 IF K9 <= 0 THEN i = 10
194 NEXT: RETURN
195 REM >>> #04 Photon Torpedoes
196 IF P3 < 1 THEN PRINT "ALL PHOTON TORPEDOES EXPENDED": RETURN
197 IF P3 < 3 THEN YNA$ = "n" ELSE YNQ$ = "DO YOU WISH TO FIRE A SPREAD": GOSUB 62
198 GOSUB 68: IF C1 = 0 THEN RETURN: REM C1=Course
199 IF YNA$ = "n" THEN P8 = 0: GOSUB 205: RETURN
200 IF CMD$ <> "^r" THEN INPUT "SPREAD ANGLE (0.05-0.30)"; C3
201 IF C3 = 0 THEN 197
202 IF C3 < .05 OR C3 > .3 THEN 200
203 C1 = C1 - C3 - C3: FOR P8 = 1 TO 3: C1 = C1 + C3: GOSUB 205: NEXT: IF P8 > 4 THEN PRINT "REMAINDER OF SPREAD ABORTED."
204 RETURN
205 REM >>> Fire One Torpedo
206 IF P8 > 0 THEN PRINT "NUMBER"; P8
207 IF RND(1) > .92 THEN PRINT "TORPEDO MISFIRES.": C1 = C1 + RND(1) * 9: P8 = 9
208 IF C1 > 1 THEN C1 = C1 + 8 ELSE IF C1 >= 9 THEN C1 = C1 - 8
209 GOSUB 73: REM Compute Tracking Constants
210 P3 = P3 - 1: IF P3 < 3 THEN PRINT "RESERVE ";
211 U2 = -1
212 PRINT "TORPEDO TRACK:";
213 U2 = U2 + 1: X% = INT(KX + (U2 * VX)): Y% = INT(KY + (U2 * VY))
214 IF X% < 1 OR X% > 8 OR Y% < 1 OR Y% > 8 THEN PRINT "TORPEDO MISSED": RETURN
215 PRINT X%; "-"; Y%; : F7 = Q(X%, Y%): IF F7 = 0 THEN 213
216 ON F7 GOTO 213, 218, 225, 224, 213, 218
217 REM          E     K     B    *     Q     C
218 i = 0: FOR J = 1 TO 9: IF K(J, 1) = X% THEN IF K(J, 2) = Y% THEN i = J: J = 9
219 NEXT: IF i = 0 THEN STOP: REM bug
220 IF RND(1) < (U2 * 3) / 100 THEN PRINT : PRINT "** KLINGON EVASIVE ACTION---": PRINT "* TORPEDO MISSED *": RETURN
221 IF RND(1) < .3 THEN PRINT : PRINT "** KLINGON EVASIVE ACTION---": PRINT "KLINGON DAMAGED BUT NOT DESTROYED": K(i, 3) = .4 * K(i, 3): RETURN
222 K(i, 3) = 0: IF F7 = 6 THEN Z3 = Q1: Z4 = Q2: GOSUB 424
223 K3 = K3 - 1: M$ = "KLINGON": K9 = K9 - 1: GOTO 226
224 S3 = S3 - 1: M$ = "STAR": GOTO 226
225 B3 = B3 - 1: M$ = "STARBASE": B9 = B9 - 1
226 Q(X%, Y%) = 0: PRINT : PRINT "***"; M$; " DESTROYED***"
227 G(Q1, Q2) = (K3 * 100) + (B3 * 10) + S3: RETURN
228 REM >>> #05 Damage Control Report
229 PRINT : PRINT "DEVICE         STATE OF REPAIR": FOR i = 1 TO 7: PRINT D$(i); TAB(16); D(i): NEXT: RETURN
230 REM >>> Klingon Destroyed Msg
231 PRINT "*** KLINGON AT SECTOR"; K(i, 1); "-"; K(i, 2); "DESTROYED."
232 IF Q(K(i, 1), K(i, 2)) = 6 THEN Z3 = Q1: Z4 = Q2: GOSUB 424
233 K3 = K3 - 1
234 K9 = K9 - 1
235 Q(K(i, 1), K(i, 2)) = 0: K(i, 3) = 0
236 G(Q1, Q2) = K3 * 100 + B3 * 10 + S3
237 RETURN
238 REM >>> Klingon Attack
239 IF C$ = "DOCKED" THEN PRINT "STARBASE SHIELDS PROTECT "; N$: RETURN
240 U3 = 1: IF S% = 1 THEN GOSUB 261: IF U3 = 1 THEN RETURN
241 J = 0: FOR i = 1 TO 9: IF K(i, 1) = 0 THEN i = 9 ELSE IF K(i, 3) > 0 THEN J = J + (K(i, 3) / FNO(i)) * 3
242 NEXT: IF J < E3 THEN 252
243 IF N1 = 5 THEN 251
244 PRINT
245 PRINT "   KLINGON COMMANDER TO "; N$; ":"
246 PRINT "AS YOU WELL KNOW, YOU ARE DANGEROUSLY LOW ON ENERGY"
247 PRINT "AND WILL PROBABLY BE DESTROYED BY MY NEXT ATTACK."
248 PRINT "AS AN OFFICER AND GENTLEMAN, I OFFER YOU A CHANCE TO "
249 PRINT "SAVE YOURSELF AND CREW----"
250 CMD$ = "": YNQ$ = "DO YOU SURRENDER": GOSUB 62: IF YNA$ = "y" THEN L2 = 1: N9 = 1: RETURN
251 IF E3 < 100! THEN M1 = 11: GOSUB 408
252 PRINT : H3 = 0: FOR i = U3 TO 10: IF K(i, 3) > 0 THEN GOSUB 257 ELSE 255
253 E3 = E3 - H3: IF E3 <= 0 THEN i = 99: GOTO 255
254 IF H3 > 180 THEN R5 = INT(RND(1) * 7 + 1): D(R5) = D(R5) - (H3 / 200) * (1.5 + RND(1)): PRINT "*** CRITICAL HIT, "; : PRINT D$(R5); " DAMAGED ***"
255 NEXT: IF i > 90 THEN PRINT "******** B L A M ! *********": KIRK = 0: E3 = 1 ELSE IF H3 > 0 THEN PRINT "ENERGY LEVEL REDUCED TO"; E3
256 RETURN
257 REM >>> Hit on Starship
258 H3 = (K(i, 3) / FNO(i)) * (2 + RND(1))
259 PRINT H3; "UNIT HIT ON "; N$; "FROM KLINGON, SECTOR"; K(i, 1); "-"; K(i, 2)
260 RETURN
261 REM >>> Sheilds
262 FOR i = 1 TO 10: IF K(i, 3) > 0 THEN GOSUB 257 ELSE 264
263 A3 = A3 - H3: IF A3 <= 0 THEN U3 = i + 1: i = 10
264 NEXT: GOSUB 265: RETURN
265 REM >>> Shield hit
266 PRINT "ENGINEERING TO CAPTAIN: SHIELD ENERGY "; : IF A3 > 0 THEN PRINT "IS NOW"; A3 ELSE PRINT "DRAINED!": A3 = 0: S% = 0
267 RETURN
268 REM >>> #13 Maintain Position
269 IF C$ = "DOCKED" THEN PRINT "STARBASE ENGINEERS MAKE REPAIRS": W1 = 6: GOSUB 273: RETURN
270 IF CMD$ <> "^r" THEN PRINT "SCOTTY HERE AND READY TO ATTEMPT REPAIRS"
271 YNQ$ = "SIT HERE FOR A WHOLE STARDATE": GOSUB 62: IF YNA$ = "n" THEN RETURN
272 T3 = T3 + 1: E3 = E3 - 50: PRINT N$; "CREW MAKES REPAIRS": W1 = 3: GOSUB 273: RETURN
273 REM >>> Make Repairs
274 DD = 0: FOR i = 1 TO 7: DD = DD + D(i): NEXT: IF DD = 0 THEN RETURN
275 DD = (W1 / 2) + D(6): IF DD < 0 THEN D(6) = DD: RETURN
276 J = 0: FOR i = 1 TO 7: D(i) = D(i) + DD: IF D(i) >= 0 THEN D(i) = 0: J = J + 1
277 NEXT: IF J > 6 THEN PRINT : PRINT "CHEERS HEARD FROM DAMAGE CONTROL!"
278 RETURN
279 REM >>> Ramming Klingon
280 PRINT "*** EMERGENCY ALERT ***": PRINT "*** COLLISION IMMINENT ***"
281 FOR i = 1 TO 9: IF K(i, 1) = S1 THEN IF K(i, 2) = S2 THEN K(i, 3) = 0: i = 15
282 NEXT: IF i < 15 THEN STOP: REM bug
283 PRINT N$; "RAMS KLINGON AT SECTOR"; S1; "-"; S2: PRINT "*** KLINGON DESTROYED,"; N$;
284 K3 = K3 - 1: G(Q1, Q2) = K3 * 100 + B3 * 10 + S3
285 K9 = K9 - 1: E3 = E3 - 500: FOR i = 1 TO 7: D(i) = D(i) - (RND(1) * 4): NEXT
286 IF S% > 0 THEN S% = 0: PRINT "HEAVILY DAMAGED. ***": GOSUB 228: RETURN
287 PRINT "ALSO DESTROYED. ***": KIRK = 0: RETURN
288 REM >>> #14 Print Position
289 PRINT CHR$(10); "CURRENT POSITION: QUADRANT"; Q1; "-"; Q2; " SECTOR"; S1; "-"; S2; ".": PRINT : RETURN
290 REM >>> #10 Death Ray
291 IF B9 < 1 THEN 293 ELSE IF L3 > .9 THEN PRINT "DEATH RAY PERMANENTLY OUT OF ORDER.": RETURN ELSE L3 = RND(1)
292 IF T3 < T0 + 10 THEN PRINT "DEATH RAY CANNOT BE USED UNTIL STARDATE"; T0 + 10: RETURN
293 IF CMD$ <> "^r" THEN YNQ$ = "FIRE EXPERIMENTAL DEATH RAY": GOSUB 62: IF YNA$ = "n" THEN RETURN
294 IF S% > 0 THEN PRINT "YOU MUST LOWER YOUR SHIELDS TO USE THE DEATH RAY.": RETURN
295 IF E3 > 200 THEN IF RND(1) > .5 THEN PRINT "*THERMAL REACTOR ENERGY DRAIN.": PRINT .95 * E3; "UNITS OF ENERGY BURNED.": E3 = .05 * E3
296 IF RND(1) > .3 THEN 301 ELSE PRINT "*MATTER/ANTI-MATTER TRANSFORMATION."
297 IF K3 > 0 THEN 299 ELSE PRINT " TEMPORARY PSEUDO-STARS CREATED FROM ENERGY.": FOR i = 1 TO 8: FOR J = 1 TO 8: IF Q(i, J) = 0 THEN IF RND(1) > .5 THEN Q(i, J) = 4
298 NEXT: NEXT: GOTO 301
299 PRINT "KLINGONS HIT BY MAIN BEAM DUPLICATED.": PRINT "ENTIRE QUADRANT DISORDERD.": K0 = K0 - K3: K9 = K9 - K3: K3 = K3 + K3: IF K3 > 8 THEN K3 = 9
300 K0 = K0 + K3: K9 = K9 + K3: G(Q1, Q2) = K3 * 100 + B3 * 10 + S3: QQ1 = 0
301 PRINT : PRINT "*** DEATH RAY "; : IF RND(1) < .5 THEN PRINT "TEMPORARY FAILURE": RETURN
302 IF RND(1) > .9 THEN PRINT "BACKFIRES ***": PRINT "*** BETTER LUCK NEXT TIME ***": KIRK = 0: RETURN
303 IF RND(1) < .5 THEN PRINT "MISSES": RETURN
304 IF K3 < 1 THEN 308
305 PRINT "ANNIHILATES ALL KLINGONS IN QUADRANT"; Q1; "-"; Q2: K9 = K9 - K3: IF K9 <= 0 THEN RETURN
306 FOR i = 1 TO 8: FOR J = 1 TO 8: IF (Q(i, J) = 6) OR (Q(i, J) = 2) THEN Q(i, J) = 0
307 NEXT: NEXT: K3 = 0: G(Q1, Q2) = INT(B3 * 10 + S3): Z3 = Q1: Z4 = Q2: GOSUB 424: IF RND(1) > .5 THEN RETURN
308 GOSUB 310: IF N1 = 3 THEN PRINT "*** ALSO DESTROYS "; N$: KIRK = 0
309 RETURN
310 K4 = K4 + K9: K9 = 0: PRINT "*** DEATH RAY GOES CRAZY ***": PRINT "*** DESTROYS EVERY KLINGON IN THE GALAXY ***": RETURN
311 REM >>> #07 Abandon Ship
312 IF N1 = 5 THEN PRINT N$; "CANNOT BE ABANDONED.": RETURN
313 IF L2 = 1 THEN PRINT "YOU MAY NOT ABANDON SHIP AFTER YOU HAVE BEEN": PRINT "ASKED TO SURRENDER.": PRINT : RETURN
314 CMD$ = "": YNQ$ = "*** ABANDON SHIP ***": GOSUB 62: IF YNA$ = "n" THEN RETURN
315 PRINT YNQ$: PRINT YNQ$: PRINT : PRINT "SERIES ENTER-BLITZ INITIATED."
316 PRINT "FAIL-SAFE AUTO-OVERRIDE INSERTED.": PRINT
317 PRINT "COMMANDER AND SELECT CREW MEMBERS OF THE OPPOSITE SEX ESCAPE IN SHUTTLE CRAFT.": PRINT
318 PRINT "*** "; N$; "REDUCED TO SUB-ATOMIC PARTICLES ***": PRINT
319 PRINT "ABANDONING SHIP COSTS 1 STARDATE.": N9 = 1: GOSUB 471: RETURN
320 REM >>> Supernova occurred
321 Z3 = 1 + INT(RND(1) * 8): Z4 = 1 + INT(RND(1) * 8): IF G(Z3, Z4) > 0 THEN 325
322 IF B9 = B0 THEN PRINT N$; "COMPUTER REPORTS: SORRY, SOME DATA LOST.": FOR J = 1 TO 8: G%(Z3, J) = 0: NEXT: FOR i = 1 TO 8: G%(i, Z4) = 0: NEXT: RETURN
323 PRINT "LT. UHURU REPORTS: STARBASE CONSTRUCTION COMPLETE!"
324 B9 = B9 + 1: G(Z3, Z4) = 10: RETURN
325 GOSUB 338: PRINT "          SUPERNOVA IN QUADRANT"; Z3; "-"; Z4;
326 IF G(Z3, Z4) > 999 THEN PRINT "COOLS OFF.": PRINT "OK TO ENTER THIS QUADRANT NOW.": G(Z3, Z4) = 0: GOTO 338
327 PRINT : PRINT "ALL THE MATTER IN THIS QUADRANT CONVERTED TO ENERGY."
328 TK3 = INT(G(Z3, Z4) / 99.99): IF TK3 > 0 THEN GOSUB 424
329 TB3 = INT((G(Z3, Z4) / 99.99 - TK3) * 10): B9 = B9 - TB3
330 K9 = K9 - TK3: K4 = K4 + TK3
331 IF Q1 = Z3 THEN IF Q2 = Z4 THEN PRINT : PRINT "UNFORTUNATELY, "; N$; "WAS IN THIS QUADRANT.": M1 = 7: GOSUB 408: KIRK = 0: GOSUB 310: RETURN
332 G(Z3, Z4) = 1000: G%(Z3, Z4) = 1: IF K9 <= 0 THEN 338
333 PRINT "FROM NOW ON, ANY VESSEL STOPPING IN THIS QUADRANT"
334 PRINT "WILL BE TOTALLY ENERGIZED."
335 IF TB3 = 0 THEN 338
336 PRINT N$; "RECEIVES EMERGENCY SUPPLIES FROM": PRINT "THE DESTROYED STARBASE."
337 E3 = E0: P3 = P0: A3 = A0: IF B9 = 0 THEN E3 = E3 * 3: P3 = P3 * 3: A3 = A3 * 3
338 PRINT "****************************************************": RETURN
339 REM >>> Magnetic K-Capture
340 PRINT "MR CHEKOV: CAPTAIN, MY CONSOLE IS LOCKED!  PLEASE PRESS <C>.": WHILE INKEY$ <> "C": WEND
341 IF K3 > 0 THEN QQ1 = 0: Z6 = 1: RETURN
342 IF C$ = "DOCKED" THEN PRINT "STARBASE SHIELDS DEFLECT TRACTOR BEAM": RETURN
343 i = 0: FOR J = 1 TO 4: IF C(J, 1) < 9 THEN i = J: J = 9
344 NEXT: IF i = 0 THEN PRINT "FEEBLE TRACTOR BEAM DEFLECTED": C(1, 2) = 9: RETURN
345 i = 0: WHILE i = 0: FOR J = 1 TO 4: IF C(J, 1) < 9 THEN IF RND(1) > .5 THEN i = J: J = 9
346 NEXT: WEND
347 PRINT "SCOTTY REPORTS: CAPTAIN, THE DILYTHIUM CRYSTAL ENERGY IS"; E3
348 IF E3 < 300 THEN PRINT "IT'S NOT ENOUGH TO BREAK FREE!": GOTO 352
349 CMD$ = "": YNQ$ = "SHALL I TRY TO BREAK FREE": GOSUB 62: IF YNA$ = "n" THEN 352
350 E3 = (E3 - 200) / 2: IF RND(1) < .2 THEN 347
351 PRINT "WE DID IT, CAPTAIN!": i = 0: RETURN
352 Q1 = C(i, 1): Q2 = C(i, 2): QQ1 = 0
353 T3 = T3 + .5
354 FOR i = 1 TO 7: D(i) = D(i) + 1: IF D(i) > 0 THEN D(i) = 0
355 NEXT: RETURN
356 REM >>> Space Storm / Truce
357 IF C$ = "DOCKED" THEN PRINT "CREW ENJOYING SHORE LEAVE": RETURN
358 FOR J = 1 TO 5: i = INT(1 + RND(1) * 7): IF D(i) < 0 THEN J = 5
359 NEXT: J = D(i): IF J >= 0 THEN D(i) = -1 - RND(1) * 5 ELSE D(i) = J + 1 + RND(1) * 5: IF D(i) > 0 THEN D(i) = 0
360 IF J < 0 THEN PRINT "*** TEMPORARY TRUCE, "; D$(i); : IF D(i) = 0 THEN PRINT " FIXED ***": RETURN ELSE PRINT " STATE OF REPAIR IMPROVED ***": RETURN
361 PRINT "*** SPACE STORM*** "; : IF S% = 1 THEN PRINT "LUCKILY, SHIELDS ARE UP!": D(i) = J: A3 = A3 - 500 - INT(500 * RND(1)): GOSUB 265: RETURN
362 PRINT D$(i); " DAMAGED ***": RETURN
363 REM >>> #08 Activate Energy Shields
364 IF S% <> 0 THEN 367
365 A3 = A3 - 200: IF A3 > 0 THEN 367
366 A3 = 0: S% = 0: PRINT "SHIELD ENERGY DRAINED": RETURN
367 S% = 1: PRINT "SHIELDS ARE UP": RETURN
368 REM >>> #09 Deactivate Energy Sheilds
369 S% = 0: PRINT "SHEILDS ARE DOWN": RETURN
370 REM >>> Changing of Guard at Buckingham Palace
371 PRINT
372 B3 = 0: FOR i = 1 TO 8: FOR J = 1 TO 8
373 K3 = INT(G(i, J) / 99.99)
374 B3 = INT((G(i, J) / 99.99 - K3) * 10)
375 IF B3 > 0 THEN Q1 = i: Q2 = J: i = 8: J = 8
376 NEXT: NEXT: IF B3 > 0 THEN 384
377 PRINT " YOU HAVE BEEN TAKEN TO KLINGON HEADQUARTERS."
378 PRINT "IF YOU HAD A STARBASE, YOU WOULD BE REPATRIATED"
379 PRINT "AND GIVEN A NEW STARSHIP TO COMMAND."
380 PRINT "SINCE YOU HAVE NO STARBASE, YOU WILL BE MERCILESSLY"
381 PRINT "TORTURED TO DEATH BY THE ARCHFIEND,"
382 PRINT "CECIL DYBOWSKI, SCOURGE OF THE UNIVERSE."
383 KIRK = 0: RETURN
384 N9 = 2
385 T3 = T3 + 1
386 GOSUB 601: REM FAIRIE QUEENE constants
387 PRINT "YOU HAVE BEEN SENT BACK TO STARFLEET COMMAND."
388 PRINT "YOU ARE NOW IN COMMAND OF A NEW STARSHIP."
389 PRINT "TRY TO BE MORE CAREFUL THIS TIME."
390 FOR i = 1 TO 7: D(i) = 0: NEXT: PRINT
391 QQ1 = 0: RETURN
392 REM >>> #06 Self-Destruct
393 PRINT CHR$(10); STRING$(31, 205)
394 PRINT "SERIES ENTER-BLITZ INITIATED."
395 PRINT "IN TEN SECONDS THIS VESSEL WILL SELF-DESTRUCT."
396 FOR TX = 10 TO 1 STEP -1: GOSUB 397: NEXT: RETURN
397 PRINT CHR$(10); SPACE$(2 * (11 - TX)); TX
398 T$ = TIME$: WHILE T$ = TIME$: WEND: IF TX <> 5 THEN RETURN
399 PRINT CHR$(10); "T MINUS 5 SECONDS AND HOLDING."
400 PRINT "FAIL-SAFE MECHANISM ENGAGED.  ONLY THE COMMANDER OF"
401 PRINT "THE STARSHIP CAN CONTINUE BY ENTERING THE SECRET PASSWORD."
402 PRINT CHR$(10); "SCIENCE OFFICER SPOCK HAS ALREADY ENTERED HIS CORRECT"
403 PRINT "COUNTER-PASSWORD."; CHR$(10)
404 GOSUB 552: REM Get Password
405 IF PW$ <> V$ THEN PRINT "SERIES ENTER-BLITZ TERMINATED.": TX = 0: RETURN
406 IF K3 > 0 THEN K9 = K9 - K3: PRINT "ALL KLINGONS IN THIS QUADRANT WILL ALSO BE DESTROYED. YOU GET THE LAST LAUGH?"
407 KIRK = 0: RETURN
408 REM >>> M. Aurelius Comments
409 IF MA(M1) = 1 THEN RETURN ELSE MA(M1) = 1
410 F$ = "ma" + LEFT$(MA$(M1), 2): GOSUB 481
411 PRINT SPACE$(15); "--- Marcus Aurelius, "; RIGHT$(MA$(M1), LEN(MA$(M1)) - 2): RETURN
412 REM >>> #12 Impulse Engines
413 PRINT : PRINT "IMPULSE ENGINES ON STANDBY."
414 GOSUB 68: IF C1 = 0 THEN RETURN: REM C1=Course
415 IF CMD$ <> "^r" THEN INPUT "WARP FACTOR(.1-5)"; W1$
416 W1 = VAL(W1$): IF W1 = 0 THEN C1 = 0: RETURN
417 IF W1 < .1 OR W1 > 5 THEN 415
418 PRINT "IMPULSE ENGINES ENGAGED."
419 E3 = E3 - ((1 + (9 * S%)) * 40 * (1 + W1))
420 IF E3 <= 0 THEN C1 = 0: RETURN
421 IF W1 * W1 * W1 / 126 < RND(1) THEN RETURN
422 PRINT : PRINT "IMPULSE ENGINES IMPLODE."
423 KIRK = 0: C1 = 0: RETURN
424 REM >>> Klingon Commander Dies
425 FOR J = 1 TO 4: IF C(J, 1) = Z3 THEN IF C(J, 2) = Z4 THEN C(J, 1) = 9
426 NEXT: RETURN
427 REM >>> #11 Teleporter
428 IF RND(1) < .2 THEN PRINT "COMMUNICATIONS WITH BASE TEMPORARILY LOST--": PRINT "TELEPORTER, SHE NO WORK.": RETURN
429 H1 = H1 + 1: IF H1 > H2 THEN PRINT "TELEPORTER CAPABILITY PERMANENTLY LOST.": RETURN
430 FOR i = 1 TO 8: FOR J = 1 TO 8: TB3 = VAL(MID$(STR$(1000 + G(i, J)), 4, 1)): IF TB3 = 0 THEN 434
431 IF T3 < T0 + 6.99 THEN PRINT "MESSAGE FROM STARBASE AT ("; i; ","; J; "); TELEPORTER NOT AVAILABLE UNTIL STARDATE "; T0 + 6.99: H1 = 0: GOTO 433
432 QQ1 = 0: Q1 = i: Q2 = J: PRINT "TELEPORTER ACTIVATED": A3 = A0: E3 = E0: P3 = P0: FOR i = 1 TO 7: D(i) = 0: NEXT i
433 i = 8: J = 8
434 NEXT: NEXT: IF TB3 = 0 THEN PRINT "NO STARBASES EXIST": H1 = 0
435 IF H1 = 0 THEN RETURN
436 IF RND(1) > .15 THEN RETURN
437 PRINT "DISINTEGRATOR/INTEGRATOR MALFUNCTION--"
438 PRINT "STARSHIP MOLECULES REORIENTED AS CECIL DYBOWSKI."
439 PRINT "YOU ATE THAT ONE!"
440 KIRK = 0: RETURN
441 REM >>> Leaving Galaxy
442 L1 = L1 + 1: IF L1 > 2 THEN PRINT : PRINT "YOU HAVE DARED ENTER SUB-SPACE A THIRD TIME.": PRINT "FOR THIS, ************ YOU DIE ****************": KIRK = 0: RETURN
443 PRINT : PRINT "STARSHIP ENCOUNTERS END OF GALAXY.": PRINT
444 PRINT "FOOLISH MORTAL, YOU HAVE ATTEMPTED TO VENTURE OUT OF"
445 PRINT "THE GALAXY INTO SUB-SPACE.  ON THE THIRD TIME YOU TRY"
446 PRINT "THIS, THE LIVING GOD, KORP, WILL DESTROY YOU."
447 RETURN
448 REM >>> Random Empty Sector Generator
449 R1 = 1 + INT(RND(1) * 8): R2 = 1 + INT(RND(1) * 8): IF Q(R1, R2) = 0 THEN RETURN
450 FOR K = 1 TO 64
451 IF R1 < 8 THEN R1 = R1 + 1 ELSE R1 = 1: R2 = R2 + 1: IF R2 > 8 THEN R2 = 1
452 IF Q(R1, R2) = 0 THEN K = 64
453 NEXT: RETURN
454 REM >>> Mon Capitan, Your Orders are...
455 CLS : LOCATE 5, 16: PRINT "ORDERS:  STARDATE ="; INT((10 * T3) + .5) / 10
456 PRINT
457 PRINT "               TO:      CAPTAIN OF THE STARSHIP ENTERPRISE"
458 PRINT
459 PRINT "               AS COMMANDER OF THE UNITED STARSHIP ENTERPRISE,"
460 PRINT "               YOUR MISSION IS TO RID THE GALAXY OF THE DEADLY"
461 PRINT "               KLINGON MENACE.  TO DO THIS, YOU MUST DESTROY THE"
462 PRINT "               KLINGON INVASION FORCE OF"; K9; "BATTLE CRUISERS."
463 PRINT "               YOU HAVE"; T9 - T0; "STARDAYS TO COMPLETE YOUR MISSION."
464 PRINT "               (I.E. UNTIL STARDATE"; T9; ")."
465 PRINT
466 B0 = B9: IF B9 > 1 THEN 469
467 PRINT "               YOU WILL HAVE ONE SUPPORTING STARBASE."
468 GOTO 470
469 PRINT "               YOU WILL HAVE"; B9; "SUPPORTING STARBASES."
470 GOSUB 471: RETURN
471 REM >>> Wait for Player
472 LOCATE 25, 29: PRINT "Press < > to proceed";
473 WHILE INKEY$ <> "": WEND: K$ = "": WHILE K$ <> " ": K$ = INKEY$: WEND: CLS : RETURN
474 REM >>> Display Startrek Instructions (Short)
475 CLS : PRINT "COMMAND:"
476 LOCATE 5, 1: PRINT "In response to the above prompt,": PRINT "enter 0-15 as defined in the table."
477 PRINT : PRINT "If you enter an undefined command,": PRINT "the table will be shown again. (Press": PRINT "any key to stop the table display.)"
478 GOSUB 501: GOSUB 471: RETURN
479 REM >>> Display Startrek Instructions (Long)
480 F$ = "credits": GOSUB 481: F$ = "help": GOSUB 481: RETURN
481 REM >>> STARTREK.DOC Print Routine
482 CLOSE #1: ON ERROR GOTO 483: OPEN "STARTREK.DOC" FOR INPUT AS #1: GOTO 484
483 F$ = "": RESUME 484
484 ON ERROR GOTO 0: IF F$ = "" THEN CLS : PRINT "Can't find STARTREK.DOC": RETURN
485 IF EOF(1) THEN CLOSE : CLS : PRINT "Can't find "; F$: RETURN
486 LINE INPUT #1, L$: IF L$ <> "@0" + F$ THEN 485 ELSE L = 24: C = 1: L$ = "": GOTO 489
487 IF LEFT$(L$, 1) = "@" THEN 490
488 IF L > 24 THEN L = 24
489 LOCATE L, C: PRINT L$: GOTO 494
490 ON VAL(MID$(L$, 2, 1)) GOTO 491, 492, 493, 494, 495, 496, 497, 500
491 RETURN
492 K$ = "": WHILE K$ = "": K$ = INKEY$: WEND: WHILE INKEY$ <> "": WEND: IF K$ <> " " THEN CLS : PRINT "Interrupted": RETURN
493 CLS : L = 1: M = 1: C = M: IF LEN(L$) > 2 THEN 499
494 LINE INPUT #1, L$: L = L + 1: C = M: GOTO 487
495 M = VAL(MID$(L$, 3, 2)): C = M: GOTO 498
496 L = L + VAL(MID$(L$, 3, 2)): GOTO 498
497 C = M + VAL(MID$(L$, 3, 2))
498 L$ = RIGHT$(L$, LEN(L$) - 4): GOTO 487
499 L$ = RIGHT$(L$, LEN(L$) - 2): GOTO 487
500 GOSUB 501: GOTO 499
501 REM >>> Print COMMANDS on right of screen
502 LOCATE 1, 49: PRINT CHR$(201); STRING$(29, 205); CHR$(187)
503 FOR i = 1 TO 22
504 LOCATE i + 1, 49: PRINT CHR$(186): LOCATE i + 1, 50: PRINT MSG$(i); CHR$(186);
505 IF INKEY$ <> "" THEN i = 22
506 NEXT: WHILE INKEY$ <> "": WEND
507 LOCATE i + 1, 49: PRINT CHR$(200); STRING$(29, 205); CHR$(188);
508 LOCATE i, 1: PRINT SPACE$(15); : LOCATE , 1: RETURN
509 REM >>> Routine Initializes Map of the Galaxy
510 FOR i = 1 TO 8: FOR J = 1 TO 8: G%(i, J) = 0: NEXT: NEXT: RETURN
511 CLS : FOR i = 1 TO 8: PRINT "      Y"; i; : NEXT
512 FOR i = 1 TO 8: PRINT "      KBS "; : NEXT: RETURN
513 REM >>> #15 Print Map of the Known Galaxy
514 GOSUB 511: FOR i = 1 TO 8: LOCATE (i * 2 + 2), 1: PRINT "X"; i
515 FOR J = 1 TO 8: IF i = Q1 THEN IF J = Q2 THEN COLOR 18, 0
516 LOCATE 2 + (2 * i), -3 + (10 * J): IF LD = 0 THEN IF G%(i, J) = 0 THEN PRINT "  -": GOTO 518
517 IF G(i, J) < 999 THEN PRINT USING "###"; G(i, J) ELSE PRINT "<*>"
518 COLOR 7, 0: NEXT: NEXT: RETURN
519 REM >>> Keyboard in STARTREK mode
520 GOSUB 523: GOSUB 531: GOSUB 539: RETURN: REM STARTREK MODE
521 REM >>> Keyboard in Normal mode
522 GOSUB 527: GOSUB 535: GOSUB 543: COLOR 7, 0: RETURN: REM NORMAL MODE
523 REM --- SET FUNCTION KEYS SPECIAL FOR STARTREK
524 FOR i = 1 TO 10: K$(i) = "UFK": NEXT
525 K$(10) = "BOSS": K$(9) = "^r": K$(1) = "STOP"
526 FOR i = 1 TO 10: KEY i, "": NEXT: FOR i = 1 TO 10: KEY i, K$(i) + CHR$(13): NEXT: RETURN
527 REM --- SET FUNCTION KEYS NORMAL
528 Q$ = CHR$(34): R$ = CHR$(13): FOR i = 1 TO 10: KEY i, "": NEXT
529 KEY 1, "gosub 4130" + CHR$(13): KEY 2, "RUN" + R$: KEY 3, "LOAD" + Q$: KEY 4, "SAVE" + Q$: KEY 5, "CONT" + R$: KEY 6, "," + Q$ + "LPT1:" + Q$ + R$
530 KEY 7, "TRON" + R$: KEY 8, "TROFF" + R$: KEY 9, "KEY ": KEY 10, "SCREEN 0,0,0" + R$: RETURN
531 REM --- SET 10-KEY PAD NUMERIC FOR STARTREK
532 DEF SEG = &H40: i% = PEEK(&H17)
533 i% = i% OR &H20
534 POKE &H17, i%: DEF SEG : RETURN
535 REM --- SET 10-KEY PAD NORMAL (ARROWS)
536 DEF SEG = &H40: i% = PEEK(&H17)
537 i% = i% AND NOT &H20
538 POKE &H17, i%: DEF SEG : RETURN
539 REM --- SET KEYBOARD CAPS-LOCK ON FOR STARTREK
540 DEF SEG = &H40: i% = PEEK(&H17)
541 i% = i% OR &H40
542 POKE &H17, i%: DEF SEG : RETURN
543 REM --- SET KEYBOARD CAPS-LOCK NORMAL (OFF)
544 DEF SEG = &H40: i% = PEEK(&H17)
545 i% = i% AND NOT &H40
546 POKE &H17, i%: DEF SEG : RETURN
547 REM >>> Initial Display
548 KEY OFF: CLS : SCREEN 0, 1: COLOR 15, 0, 0: CLS : LOCATE 3, 19: PRINT "IBM": LOCATE 5, 12, 0: PRINT "Personal Computer": COLOR 10, 0: LOCATE 8, 5, 0: PRINT CHR$(213) + STRING$(31, 205) + CHR$(184)
549 LOCATE 9, 5, 0: PRINT CHR$(179) + "           STAR-TREK           " + CHR$(179): LOCATE 10, 5, 0: PRINT CHR$(179) + "                               " + CHR$(179): LOCATE 11, 5, 0: PRINT CHR$(179) + STRING$(31, 32) + CHR$(179)
550 LOCATE 12, 5, 0: PRINT CHR$(179) + "         Version 13.5          " + CHR$(179): LOCATE 13, 5, 0: PRINT CHR$(212) + STRING$(31, 205) + CHR$(190)
551 COLOR 7, 0: RETURN
552 REM >>> Get Password
553 PRINT CHR$(10): COLOR 7, 0: PRINT "PLEASE ENTER YOUR SECRET PASSWORD: ";
554 COLOR 0, 0: INPUT "", V$: COLOR 7, 0: RETURN
555 REM >>> * * M A I N   C O N T R O L * *
556 GOSUB 547: REM initial display
557 GOSUB 519: REM keyboard in startrek mode
558 PRINT CHR$(10); "    Option 1: Gametype: Short": PRINT "    Option 2: Gametype: Long": PRINT "    Option 3: Continue Adjourned Game"
559 PRINT "    Option 4: Instructions": PRINT "    Option 5: Exit Startrek Program"
560 K$ = "": PRINT "": PRINT "Option: "; : FOR i = 1 TO 25: T$ = TIME$: WHILE T$ = TIME$: K$ = INKEY$: IF K$ <> "" THEN T$ = "": i = 9999
561 WEND: NEXT: CLS : T$ = TIME$: WHILE T$ = TIME$: WEND: WHILE INKEY$ <> "": WEND: IF K$ = "" THEN K$ = "5"
562 V0 = VAL(K$): IF V0 < 1 THEN V0 = 5 ELSE IF V0 > 5 THEN V0 = 5
563 IF V0 > 2 THEN 566
564 GOSUB 576: REM Play Startrek
565 RUN
566 IF V0 > 3 THEN 568
567 GOTO 564
568 IF V0 > 4 THEN 571
569 GOSUB 479: REM Display Instructions
570 GOTO 558
571 GOSUB 521: REM Keyboard in Normal mode
572 IF VAL(K$) <> 5 THEN GOTO 748
573 CLS : LOCATE 10, 30: PRINT "AVE ATQUE VALE": LOCATE 11, 30: GOSUB 574: PRINT "--- "; : GOSUB 574: PRINT "----- "; : GOSUB 574: PRINT "----": GOSUB 574: GOTO 748
574 T$ = TIME$: WHILE T$ = TIME$: IF INKEY$ <> "" THEN CLS : STOP
575 WEND: RETURN
576 REM >>> Play Startrek
577 IF V0 = 3 THEN 592
578 CLS : LOCATE 10, 1: PRINT "ENTER PASSWORD (TO BE USED BY THE SELF-DESTRUCT COMMAND)."
579 GOSUB 552: PW$ = V$: CLS
580 IF PW$ = "" THEN RETURN
581 REM Initialize Random Number Generator
582 Y# = RND(-VAL(RIGHT$(TIME$, 2) + MID$(TIME$, 4, 2) + MID$(DATE$, 5, 1)))
583 FOR i = 1 TO 6: Y# = (10 * Y#) + RND(1): NEXT: Y = RND(-((9 * Y#) / 10))
584 LOCATE 25, 29: COLOR 26, 0: PRINT "Building the Galaxy....."; : COLOR 7, 0: GOSUB 509
585 IF V0 = 2 THEN T9 = 25 + INT(RND(1) * 11) ELSE T9 = 15 + INT(RND(1) * 6)
586 T$ = STR$(10000 + (RND(1) * 10000))
587 T0 = 2345 + VAL(MID$(T$, 4, 2) + "." + MID$(T$, 6, 1)): T3 = T0: T9 = T9 + T0
588 GOSUB 648: REM Populate Galaxy with Klingons, Starbases and Stars
589 K9 = K0
590 KIRK = 1: S% = 1
591 H1 = 0: H2 = 1 + INT(RND(1) * 4): REM Teleporter Use Limit
592 GOSUB 598: REM Simulation
593 I3 = INT(I3 - 600 - (35 * B0) + ((500 - ((A6 - A3) / K0)) * .3) + ((600 - ((E6 - E3) / K0)) * .6) + ((1.5 - ((P6 - P3) / K0)) * 66)) - (100 * MA(8)) + (KIRK * 100): IF N1 = 1 THEN I3 = I3 + 50
594 PRINT "YOUR RATING WAS:"; I3: IF I3 < 1 THEN 597
595 IF I3 > 999 THEN PRINT "YOU HAVE BEEN PROMOTED TO COMMODOR EMERITUS."
596 IF KIRK = 0 THEN PRINT "A STATUE WILL BE ERECTED IN YOUR HONOR."
597 GOSUB 471: RETURN
598 REM >>> Simulation
599 IF V0 = 3 THEN 617 ELSE 602
600 E0 = 5000: A0 = 3000: P0 = 13: N1 = 1: N$ = "THE ENTERPRISE ": RETURN
601 E0 = 3000: A0 = 2000: P0 = 8: N1 = 5: N$ = "YE FAIRIE QUEENE ": RETURN
602 GOSUB 600: GOSUB 454: REM Mon Capitan, Your Orders are ...
603 Q1 = 1 + INT(RND(1) * 8): Q2 = 1 + INT(RND(1) * 8): REM First Quadrant
604 GOSUB 112: REM Supply New Starship
605 KX = 1 + RND(1) * 8: KY = 1 + RND(1) * 8: REM Random Position in Quadrant
606 GOSUB 78: REM enter new quadrant
607 IF KIRK = 0 THEN 626: REM which had a supernova
608 IF E3 = E0 THEN  ELSE 612: REM New Starships continue below
609 GOSUB 100: REM Determine if Starship is Docked
610 GOSUB 113: REM Short Range Scan
611 C1 = 1: REM Cause Klingon Attack
612 REM - main loop -
613 GOSUB 100: REM Determine if Starship is Docked
614 IF C1 > 0 THEN IF K3 > 0 THEN GOSUB 238: REM Klingon Attack
615 IF K9 <= 0 OR E3 <= 0 OR T3 > T9 OR KIRK = 0 THEN 626
616 IF N9 = 1 THEN 627
617 C1 = 0: GOSUB 6: REM Process Captain's Command
618 E3 = E3 - 5: T3 = T3 + .005
619 IF K9 <= 0 OR E3 <= 0 OR T3 > T9 OR KIRK = 0 THEN 626
620 IF N9 = 1 THEN 627
621 IF Q1 = QQ1 THEN IF Q2 = QQ2 THEN 612
622 IF C1 > 0 THEN IF K3 > 0 THEN GOSUB 238: REM Klingon Attack
623 IF K9 <= 0 OR E3 <= 0 OR T3 > T9 OR KIRK = 0 THEN 626
624 IF N9 = 1 THEN 627
625 GOTO 606
626 GOSUB 629: RETURN
627 GOSUB 370: REM Changing of Guard at Buckingham Palace
628 IF KIRK = 0 THEN 626 ELSE 604
629 REM >>> End-of-Simulation Messages
630 i1 = ((K0 - K4 - K9) * (T9 - T0)) / (1 + T3 - T0): IF i1 < 1 THEN i1 = 1
631 I2 = T9 - T3: IF I2 < 0 THEN I2 = 0
632 I3 = INT(1000 * SQR(i1 / (i1 + 3.14)) + 500 * SQR(I2 / (I2 + 1.73)) - 500 * SQR(K9))
633 GOSUB 471: LOCATE 24, 31: PRINT "IT IS STARDATE"; INT((10 * T3) + .5) / 10: PRINT
634 IF T3 > T9 THEN PRINT N$; "DESTROYED BY KLINGON SECRET WEAPON": GOTO 641
635 IF E3 <= 0 THEN PRINT "ENERGY GONE! YOU DRIFT AIMLESSLY IN SPACE.": KIRK = 0: GOTO 641
636 IF KIRK = 1 THEN 645
637 FOR i = 1 TO 2: PRINT STRING$(54, "*"): NEXT
638 PRINT " ** ENTROPY OF "; N$; "MAXIMIZED **************"
639 IF E3 <= 0 THEN M1 = 10: GOSUB 408
640 PRINT N$; "HAS BEEN DESTROYED."
641 IF K9 < 1 THEN KIRK = 0: GOTO 645
642 PRINT "THERE ARE STILL"; K9; "KLINGON BATTLE CRUISERS."
643 IF I3 < 0 THEN PRINT "THE FEDERATION WILL BE CONQUERED!": RETURN
644 PRINT "YOUR OLD UNIVERSITY RIVAL, ROLO, WILL SAVE THE FEDERATION.": RETURN
645 M1 = 9: GOSUB 408
646 PRINT "THE LAST KLINGON BATTLE CRUISER IN THE GALAXY HAS BEEN"
647 PRINT "DESTROYED.  THE FEDERATION HAS BEEN SAVED.": RETURN
648 REM >>> Populate Galaxy with Klingons, Starbases and Stars
649 K9 = 0: IF V0 = 2 THEN GOSUB 663: Z1 = 2.3 ELSE GOSUB 657: Z1 = .6
650 B9 = 0: FOR i = 1 TO INT((K0 / 15) + 3 - Z1): B9 = B9 + (3 * RND(1)): NEXT: WHILE B9 < 2: B9 = B9 + RND(1): WEND: B9 = INT(B9 / 2)
651 FOR i = 1 TO B9: R1 = 1 + INT(RND(1) * 8): R2 = 1 + INT(RND(1) * 8): G(R1, R2) = G(R1, R2) + 10: NEXT
652 FOR i = 1 TO 4: GOSUB 654: NEXT: REM Add Klingon Commanders
653 RETURN
654 C(i, 1) = 9: IF RND(1) + Z1 < 1 THEN RETURN
655 R1 = 1 + INT(RND(1) * 8): R2 = 1 + INT(RND(1) * 8): IF G(R1, R2) > 700 THEN RETURN
656 C(i, 1) = R1: C(i, 2) = R2: G(R1, R2) = G(R1, R2) + 100: K0 = K0 + 1: Z1 = Z1 / 2: RETURN
657 REM >>> Setup for Short Game
658 FOR i = 1 TO 8: FOR J = 1 TO 8: R7 = RND(1) * 64
659 IF R7 >= 9.28 THEN K3 = 0 ELSE IF R7 >= 5.28 THEN K3 = 1 ELSE IF R7 >= 2! THEN K3 = 2 ELSE IF R7 >= .78 THEN K3 = 3 ELSE K3 = 4
660 K0 = K0 + K3
661 G(i, J) = (K3 * 100) + 1 + INT(RND(1) * 8)
662 NEXT: NEXT: RETURN
663 REM >>> Setup for Long Game
664 FOR i = 1 TO 8: FOR J = 1 TO 8: R7 = RND(1) * 64
665 IF R7 >= 1! THEN IF R7 >= 14.28 THEN K3 = 0 ELSE IF R7 >= 9! THEN K3 = 1 ELSE IF R7 >= 6.28 THEN K3 = 2 ELSE IF R7 >= 3! THEN K3 = 3 ELSE IF R7 >= 1.5 THEN K3 = 4 ELSE K3 = 5
666 IF R7 < 1! THEN IF R7 >= .5 THEN K3 = 6 ELSE IF R7 >= .25 THEN K3 = 7 ELSE IF R7 >= 9.999999E-02 THEN K3 = 8 ELSE K3 = 9
667 K0 = K0 + K3
668 G(i, J) = (K3 * 100) + 1 + INT(RND(1) * 8)
669 NEXT: NEXT: RETURN
670 REM >>> Initialize Constants
671 MSG$(1) = " 0  LAY IN COURSE-WARP SPEED "
672 MSG$(2) = " 1  SHORT RANGE SENSOR SCAN  "
673 MSG$(3) = " 2  LONG RANGE SENSOR SCAN   "
674 MSG$(4) = " 3  FIRE PHASERS             "
675 MSG$(5) = " 4  FIRE PHOTON TORPEDOES    "
676 MSG$(6) = " 5  DAMAGE CONTROL REPORT    "
677 MSG$(7) = " 6  SELF-DESTRUCT            "
678 MSG$(8) = " 7  ABANDON SHIP             "
679 MSG$(9) = " 8  ACTIVATE ENERGY SHEILDS  "
680 MSG$(10) = " 9  DEACTIVATE ENERGY SHEILD "
681 MSG$(11) = "10  FIRE EXPERIMNT DEATH RAY "
682 MSG$(12) = "11  BEAM TO STAR BASE        "
683 MSG$(13) = "12  ENGAGE IMPULSE ENGINES   "
684 MSG$(14) = "13  ATTEMPT REPAIRS TO SHIP  "
685 MSG$(15) = "14  PRINT CURRENT POSITION   "
686 MSG$(16) = "15  MAP OF KNOWN GALAXY      "
687 MSG$(17) = "                             "
688 MSG$(18) = "  Compass Rose     4  3  2   "
689 MSG$(19) = "   for Course       \ | /    "
690 MSG$(20) = "   Setting of     5---|---1  "
691 MSG$(21) = " Enterprise and     / | \    "
692 MSG$(22) = "   Torpedoes       6  7  8   "
693 FOR i = 1 TO 7: READ D$(i): NEXT: DATA "WARP ENGINES", "S. R. SENSORS", "L. R. SENSORS", "PHASER CONTROL", "PHOTON TUBES", "DAMAGE CONTROL", "ENERGY SHIELDS"
694 FOR i = 0 TO 6: Q$(i) = MID$(".EKB*QC", i + 1, 1): NEXT
695 FOR i = 1 TO 11: READ MA$(i): NEXT: DATA 01VIII.6,02V.24,03VIII.5,04IV.29,05V.17,06IV.2,07IV.10,08III.11,09IV.20,10VIII.18,11X.36
696 RETURN
697 REM >>> Open Save/Restore File
698 OPEN "startrek.sav" FOR RANDOM AS #2 LEN = 96: R00 = 0: FIELD #2, 96 AS R01$: RETURN
699 REM >>> Save Game
700 PRINT "Saving . . .";
701 GOSUB 697: GOTO 705
702 KK$ = "   ": K = -2: FOR i = R01 TO R01 + 3: FOR J = 1 TO 8: K = K + 3: LSET KK$ = RIGHT$(" " + STR$(G(i, J)), 3)
703 IF KK$ = "000" THEN MID$(R01$, K, 3) = "999" ELSE MID$(R01$, K, 3) = KK$
704 NEXT: NEXT: R00 = R00 + 1: PUT #2, R00: RETURN
705 R01 = 1: GOSUB 702: R01 = 5: GOSUB 702
706 K = 0: FOR i = 1 TO 8: FOR J = 1 TO 8: K = K + 1: MID$(R01$, K, 1) = RIGHT$(STR$(G%(i, J)), 1): NEXT: NEXT: R00 = R00 + 1: PUT #2, R00
707 FOR K = 1 TO 11: MID$(R01$, K, 1) = RIGHT$(STR$(MA(K)), 1): NEXT
708 FOR i = 1 TO 9: FOR J = 1 TO 2: K = K + 1: MID$(R01$, K, 1) = RIGHT$(STR$(K(i, J)), 1): NEXT: NEXT
709 FOR i = 1 TO 8: FOR J = 1 TO 8: K = K + 1: MID$(R01$, K, 1) = RIGHT$(STR$(Q(i, J)), 1): NEXT: NEXT: R00 = R00 + 1: PUT #2, R00
710 GOSUB 712: CLOSE : PRINT : RETURN
711 K = -3: FOR i = 1 TO 24: K = K + 4: MID$(R01$, K, 4) = MKS$(R02(i)): NEXT: R00 = R00 + 1: PUT #2, R00: RETURN
712 R02(1) = KIRK: R02(2) = QQ1: R02(3) = QQ2: R02(4) = Q1: R02(5) = Q2: R02(6) = KX: R02(7) = KY: R02(8) = S1: R02(9) = S2: R02(10) = L3
713 FOR i = 1 TO 7: R02(10 + i) = D(i): NEXT
714 R02(18) = E3: R02(19) = E0: R02(20) = K9: R02(21) = K3: R02(22) = K4: R02(23) = K0: R02(24) = L1: GOSUB 711
715 K = 0: FOR i = 1 TO 4: FOR J = 1 TO 2: K = K + 1: R02(K) = C(i, J): NEXT: NEXT
716 FOR i = 1 TO 9: R02(8 + i) = K(i, 3): NEXT
717 R02(18) = N1: R02(19) = P3: R02(20) = P0: R02(21) = A3: R02(22) = A0: R02(23) = S%: R02(24) = S3: GOSUB 711
718 R02(1) = B3: R02(2) = B9: R02(3) = T3: R02(4) = T9: R02(5) = T0: R02(6) = N9: R02(7) = L2: R02(8) = H1: R02(9) = H2: R02(10) = V0: R02(11) = A6: R02(12) = E6: R02(13) = P6: R02(14) = B0: R02(15) = M2
719 R02(16) = -32000 * RND(1): Y = RND(R02(16)): GOSUB 711
720 LSET R01$ = "McLamore" + CHR$(0) + C$ + CHR$(0) + PW$ + CHR$(0) + N$ + STRING$(96, 0): R00 = R00 + 1: PUT #2, R00
721 RETURN
722 REM >>> Restore Game
723 CLS : PRINT "Restoring . . .";
724 ON ERROR GOTO 725: OPEN "startrek.sav" FOR INPUT AS #2: ON ERROR GOTO 0: CLOSE #2: GOSUB 697: GOTO 729
725 PRINT : PRINT "No game to restore??": PRINT "Press any key to proceed": WHILE INKEY$ = "": WEND: RUN
726 R00 = R00 + 1: GET #2, R00: K = -2: FOR i = R01 TO R01 + 3: FOR J = 1 TO 8: K = K + 3
727 G(i, J) = VAL(MID$(R01$, K, 3)): IF G(i, J) = 999 THEN G(i, J) = 1000
728 NEXT: NEXT: RETURN
729 R01 = 1: GOSUB 726: R01 = 5: GOSUB 726
730 R00 = R00 + 1: GET #2, R00: K = 0: FOR i = 1 TO 8: FOR J = 1 TO 8: K = K + 1: G%(i, J) = VAL(MID$(R01$, K, 1)): NEXT: NEXT
731 R00 = R00 + 1: GET #2, R00: FOR K = 1 TO 11: MA(K) = VAL(MID$(R01$, K, 1)): NEXT
732 FOR i = 1 TO 9: FOR J = 1 TO 2: K = K + 1: K(i, J) = VAL(MID$(R01$, K, 1)): NEXT: NEXT
733 FOR i = 1 TO 8: FOR J = 1 TO 8: K = K + 1: Q(i, J) = VAL(MID$(R01$, K, 1)): NEXT: NEXT
734 GOSUB 736: CLOSE : CLS : RETURN
735 R00 = R00 + 1: GET #2, R00: K = -3: FOR i = 1 TO 24: K = K + 4: R02(i) = CVS(MID$(R01$, K, 4)): NEXT: RETURN
736 GOSUB 735: KIRK = R02(1): QQ1 = R02(2): QQ2 = R02(3): Q1 = R02(4): Q2 = R02(5): KX = R02(6): KY = R02(7): S1 = R02(8): S2 = R02(9): L3 = R02(10)
737 FOR i = 1 TO 7: D(i) = R02(10 + i): NEXT
738 E3 = R02(18): E0 = R02(19): K9 = R02(20): K3 = R02(21): K4 = R02(22): K0 = R02(23): L1 = R02(24)
739 GOSUB 735: K = 0: FOR i = 1 TO 4: FOR J = 1 TO 2: K = K + 1: C(i, J) = R02(K): NEXT: NEXT
740 FOR i = 1 TO 9: K(i, 3) = R02(8 + i): NEXT
741 N1 = R02(18): P3 = R02(19): P0 = R02(20): A3 = R02(21): A0 = R02(22): S% = R02(23): S3 = R02(24)
742 GOSUB 735: B3 = R02(1): B9 = R02(2): T3 = R02(3): T9 = R02(4): T0 = R02(5): N9 = R02(6): L2 = R02(7): H1 = R02(8): H2 = R02(9): V0 = R02(10): A6 = R02(11): E6 = R02(12): P6 = R02(13): B0 = R02(14): M2 = R02(15)
743 Y = RND(R02(16))
744 R00 = R00 + 1: GET #2, R00: i = INSTR(R01$, CHR$(0)) + 1: IF i <> 10 THEN STOP
745 J = INSTR(i, R01$, CHR$(0)): C$ = MID$(R01$, i, J - i): i = J + 1
746 J = INSTR(i, R01$, CHR$(0)): PW$ = MID$(R01$, i, J - i): i = J + 1
747 J = INSTR(i, R01$, CHR$(0)): N$ = MID$(R01$, i, J - i): RETURN
748 IF DEBUG = 1 THEN PRINT "DEBUG MODE: Enter RUN": STOP ELSE CLS : SYSTEM
800 REM >>> Sean L. Woods, 85 Maple Ave., Middletown RI 02840
801 REM >>> Hilliard McLamore, 8837 Ashgrove House Lane, Vienna VA 22182

